
public class RGBColor {
	private int _red;
	private int _green;
	private int _blue;
	
	public RGBColor()
	{
		setRed(0);
		setGreen(0);
		setBlue(0);
	}
	
	public RGBColor(int R, int G, int B)
	{
		setRed(R);
		setGreen(G);
		setBlue(B);
	}
	
	public RGBColor(RGBColor other)
	{
		setRed(other.getRed());
		setGreen(other.getGreen());
		setBlue(other.getBlue());
	}

	public int getRed() {
		return _red;
	}

	public void setRed(int _red) {
		this._red = _red;
	}

	public int getGreen() {
		return _green;
	}

	public void setGreen(int _green) {
		this._green = _green;
	}

	public int getBlue() {
		return _blue;
	}

	public void setBlue(int _blue) {
		this._blue = _blue;
	}
	
	public String toString()
	{
		return "("+_red +","+ _green + "," + _blue + ")";
	}
	
	public boolean equals(RGBColor other)
	{
		if(_red != other.getRed())
			return false;
		if(_green != other.getGreen())
			return false;
		if(_blue != other.getBlue())
			return false;
		return true;
	}
	
	public void mix(RGBColor other)
	{
		_red = ((_red + other.getRed()) / 2);
		_green = ((_green + other.getGreen()) / 2);
		_blue = ((_blue + other.getBlue()) / 2);
	}
	
	public double convertToGrayScale()
	{
		return (0.3 * _red + 0.59 * _green + 0.11 * _blue);
	}
	
	public void invert()
	{
		_red = 255 - _red;
		_green = 255 - _green;
		_blue = 255 - _blue;
	}
}
